home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / TextEncodingConverter.a < prev    next >
Text File  |  1996-05-01  |  6KB  |  230 lines

  1. ;
  2. ;    File:        TextEncodingConverter.a
  3. ;
  4. ;    Contains:    Text Encoding Conversion Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.1 through System 8
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__TEXTENCODINGCONVERTER__') = 'UNDEFINED' THEN
  19. __TEXTENCODINGCONVERTER__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.     IF &TYPE('__UNICODE__') = 'UNDEFINED' THEN
  28.     include 'Unicode.a'
  29.     ENDIF
  30.     IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
  31. ;  converter object reference 
  32.  
  33.  
  34. ;  character substitution 
  35. CharSubstitution        RECORD 0
  36. originalChar             ds.l    1                ; offset: $0 (0)
  37. replacementChar             ds.l    1                ; offset: $4 (4)
  38. sizeof                     EQU *                    ; size:   $8 (8)
  39.                         ENDR
  40. CharSubstitutionList    RECORD 0
  41. numberOfSubstitutions     ds.l    1                ; offset: $0 (0)
  42. list                     ds        CharSubstitution ; offset: $4 (4) <-- really an array of length one
  43. sizeof                     EQU *                    ; size:   $C (12)
  44.                         ENDR
  45. ;  invalid character lists 
  46. InvalidCharRange        RECORD 0
  47. firstCharInRange         ds.l    1                ; offset: $0 (0)
  48. lastCharInRange             ds.l    1                ; offset: $4 (4)
  49. sizeof                     EQU *                    ; size:   $8 (8)
  50.                         ENDR
  51. InvalidCharRangeList    RECORD 0
  52. numberOfRanges             ds.l    1                ; offset: $0 (0)
  53. list                     ds        InvalidCharRange ; offset: $4 (4) <-- really an array of length one
  54. sizeof                     EQU *                    ; size:   $C (12)
  55.                         ENDR
  56. ;  encoding conversion options 
  57. EncodingOptions            RECORD 0
  58. sourceflags                 ds.w    1                ; offset: $0 (0)
  59. destflags                 ds.w    1                ; offset: $2 (2)
  60. maxLineLength             ds.l    1                ; offset: $4 (4)
  61. sizeof                     EQU *                    ; size:   $8 (8)
  62.                         ENDR
  63.     ENDIF
  64.     IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
  65. ;  return number of encodings types supported by user's configuraton of the encoding converter 
  66. ;
  67. ; pascal OSStatus CountAvailableTextEncodings(ItemCount *numberOfMappings)
  68. ;
  69.     IF ¨ GENERATINGCFM THEN
  70.         Macro
  71.         _CountAvailableTextEncodings
  72.             move.w              #$021A,D0
  73.             dc.w                $ABCE
  74.         EndM
  75.     ELSE
  76.         IMPORT_CFM_FUNCTION CountAvailableTextEncodings
  77.     ENDIF
  78.  
  79. ;  fill in an array of type TextEncoding passed in by the user with types of encodings the current configuration of the encoder can handle. 
  80. ;
  81. ; pascal OSStatus GetAvailableTextEncodings(TextEncoding *availableEncodings, ItemCount maxAvailableEncodings, ItemCount *actualAvailableEncodings)
  82. ;
  83.     IF ¨ GENERATINGCFM THEN
  84.         Macro
  85.         _GetAvailableTextEncodings
  86.             move.w              #$061B,D0
  87.             dc.w                $ABCE
  88.         EndM
  89.     ELSE
  90.         IMPORT_CFM_FUNCTION GetAvailableTextEncodings
  91.     ENDIF
  92.  
  93. ;  create a converter object with default conversion characteristics 
  94. ;
  95. ; pascal OSStatus NewEncodingConverter(EncodingConverterRef *newEncodingConverter, TextEncoding inputEncoding, TextEncoding outputEncoding)
  96. ;
  97.     IF ¨ GENERATINGCFM THEN
  98.         Macro
  99.         _NewEncodingConverter
  100.             move.w              #$061C,D0
  101.             dc.w                $ABCE
  102.         EndM
  103.     ELSE
  104.         IMPORT_CFM_FUNCTION NewEncodingConverter
  105.     ENDIF
  106.  
  107. ;  disose and encoding converter object 
  108. ;
  109. ; pascal OSStatus DisposeEncodingConverter(EncodingConverterRef *newEncodingConverter)
  110. ;
  111.     IF ¨ GENERATINGCFM THEN
  112.         Macro
  113.         _DisposeEncodingConverter
  114.             move.w              #$021D,D0
  115.             dc.w                $ABCE
  116.         EndM
  117.     ELSE
  118.         IMPORT_CFM_FUNCTION DisposeEncodingConverter
  119.     ENDIF
  120.  
  121. ;  manage substitution lists 
  122. ;
  123. ; pascal OSStatus SetConverterSubstitutionList(EncodingConverterRef *encodingConverter, CharSubstitutionList *charSubstitutionPtr)
  124. ;
  125.     IF ¨ GENERATINGCFM THEN
  126.         Macro
  127.         _SetConverterSubstitutionList
  128.             move.w              #$041E,D0
  129.             dc.w                $ABCE
  130.         EndM
  131.     ELSE
  132.         IMPORT_CFM_FUNCTION SetConverterSubstitutionList
  133.     ENDIF
  134.  
  135. ;
  136. ; pascal OSStatus GetConverterSubstitutionListCount(EncodingConverterRef *encodingConverter, ItemCount *count)
  137. ;
  138.     IF ¨ GENERATINGCFM THEN
  139.         Macro
  140.         _GetConverterSubstitutionListCount
  141.             move.w              #$041F,D0
  142.             dc.w                $ABCE
  143.         EndM
  144.     ELSE
  145.         IMPORT_CFM_FUNCTION GetConverterSubstitutionListCount
  146.     ENDIF
  147.  
  148. ;
  149. ; pascal OSStatus GetConverterSubstitutionList(EncodingConverterRef *encodingConverter, CharSubstitutionList *charSubstitutionPtr)
  150. ;
  151.     IF ¨ GENERATINGCFM THEN
  152.         Macro
  153.         _GetConverterSubstitutionList
  154.             move.w              #$0220,D0
  155.             dc.w                $ABCE
  156.         EndM
  157.     ELSE
  158.         IMPORT_CFM_FUNCTION GetConverterSubstitutionList
  159.     ENDIF
  160.  
  161. ;  manage invalid character lists 
  162. ;
  163. ; pascal OSStatus SetConverterInvalidCharRangeList(EncodingConverterRef *encodingConverter, InvalidCharRangeList *invalidCharPtr)
  164. ;
  165.     IF ¨ GENERATINGCFM THEN
  166.         Macro
  167.         _SetConverterInvalidCharRangeList
  168.             move.w              #$0421,D0
  169.             dc.w                $ABCE
  170.         EndM
  171.     ELSE
  172.         IMPORT_CFM_FUNCTION SetConverterInvalidCharRangeList
  173.     ENDIF
  174.  
  175. ;
  176. ; pascal OSStatus GetConverterInvalidCharRangeListCount(EncodingConverterRef *encodingConverter, ItemCount *count)
  177. ;
  178.     IF ¨ GENERATINGCFM THEN
  179.         Macro
  180.         _GetConverterInvalidCharRangeListCount
  181.             move.w              #$0422,D0
  182.             dc.w                $ABCE
  183.         EndM
  184.     ELSE
  185.         IMPORT_CFM_FUNCTION GetConverterInvalidCharRangeListCount
  186.     ENDIF
  187.  
  188. ;
  189. ; pascal OSStatus GetConverterInvalidCharRangeList(EncodingConverterRef *encodingConverter, InvalidCharRangeList *invalidCharPtr)
  190. ;
  191.     IF ¨ GENERATINGCFM THEN
  192.         Macro
  193.         _GetConverterInvalidCharRangeList
  194.             move.w              #$0423,D0
  195.             dc.w                $ABCE
  196.         EndM
  197.     ELSE
  198.         IMPORT_CFM_FUNCTION GetConverterInvalidCharRangeList
  199.     ENDIF
  200.  
  201. ;
  202. ; pascal OSStatus ConvertTextEncoding(EncodingConverterRef *encodingConverter, Boolean clearContext, BytePtr *inputText, ByteCount *inputLength, BytePtr outputBuffer, ByteCount outputBufferSize, ByteCount *actualOutputLength)
  203. ;
  204.     IF ¨ GENERATINGCFM THEN
  205.         Macro
  206.         _ConvertTextEncoding
  207.             move.w              #$1024,D0
  208.             dc.w                $ABCE
  209.         EndM
  210.     ELSE
  211.         IMPORT_CFM_FUNCTION ConvertTextEncoding
  212.     ENDIF
  213.  
  214. ;
  215. ; pascal OSStatus ExamineTextEncoding(BytePtr *inputText, ByteCount *inputLength, TextEncoding *availableEncodings, ItemCount maxAvailableEncodings, Boolean *validEncoding)
  216. ;
  217.     IF ¨ GENERATINGCFM THEN
  218.         Macro
  219.         _ExamineTextEncoding
  220.             move.w              #$0A25,D0
  221.             dc.w                $ABCE
  222.         EndM
  223.     ELSE
  224.         IMPORT_CFM_FUNCTION ExamineTextEncoding
  225.     ENDIF
  226.  
  227.     ENDIF
  228.     ENDIF ; __TEXTENCODINGCONVERTER__ 
  229.  
  230.